package com.three.digit.tools;

import java.util.ArrayList;
import java.util.List;

import com.three.digit.ResourcesHanlder;
import com.three.digit.model.Point;
import com.three.digit.model.Tendency;

public class SanDFactory
{
    public static List <Tendency> createTendencies (int tendencyItem)
    {
        List <Point> his = Utils.readPoints (ResourcesHanlder.HIS_DATA_PATH);

        List <Tendency> rtn = new ArrayList <Tendency> ();

        for (int i = 0, ii = his.size (); i < ii; i++)
        {
            List <Point> before = new ArrayList <Point> ();

            for (int j = 0; j < tendencyItem && (i + j) < ii; j++)
            {
                before.add (his.get (i + j));
            }

            if (before.size () == tendencyItem && (i + tendencyItem) < ii)
            {
                Tendency tendency = new Tendency (before, his.get (i + tendencyItem));
                rtn.add (tendency);
            }
        }

        return rtn;
    }
}
